using System;
using System.IO;
using System.Diagnostics;
using System.Collections.Generic;

using Weazel.Math;

public class OutPort_euclid_gcd : IOutport
{
    
    // Caches the outport value.
    internal Integer Value;
    
    internal String EntityName;
    
    /// The cycle for which the value field was last evaluated (debug purpose)
    internal Int32 Cycle;
    
    // The constant value 0
    // The constant value 0
    // The constant value 0
    // The constant value 0
    // The constant value 0
    // The constant value 0
    internal Integer Constant_0;
    
    // Used to evaluate expression: m > n
    internal Integer Value_binaryexpression109;
    
    // Used to evaluate expression: m > n ? m : n
    internal Integer Value_ternaryexpression112;
    
    // Used to evaluate expression: (m > n ? m : n) << factor
    internal Integer Value_binaryexpression114;
    
    // Used for depth-first-search on outports
    internal Color color;
    
    internal IOutport[] DependentOutports_ControlStep_0;
    
    internal IOutport[] DependentOutports_ControlStep_1;
    
    internal IOutport[] DependentOutports_ControlStep_2;
    
    internal IOutport[] DependentOutports_ControlStep_3;
    
    internal IOutport[] DependentOutports_ControlStep_4;
    
    internal IOutport[] DependentOutports_ControlStep_5;
    
    internal IOutport[] DependentOutports_ControlStep_6;
    
    public virtual Color _Color
    {
        get
        {
            return this.color;
        }
        set
        {
            this.color = value;
        }
    }
    
    public virtual void Evaluate()
    {
      switch(Simulator.controller_euclid_ctl.CurrentControlStep)
      {
      case 0:
        this.Value.ValueCopy(this.Constant_0);
        break;
      case 1:
        if ((Simulator.register_euclid_m.StoredValue > Simulator.register_euclid_n.StoredValue))
        {
            this.Value_binaryexpression109 = Integer.One;
        }
        else
        {
            this.Value_binaryexpression109 = Integer.Zero;
        }
        if ((Integer.Zero != this.Value_binaryexpression109))
        {
            this.Value_ternaryexpression112.ValueCopy(Simulator.register_euclid_m.StoredValue);
        }
        else
        {
            this.Value_ternaryexpression112.ValueCopy(Simulator.register_euclid_n.StoredValue);
        }
        Integer.ShiftLeft(ref this.Value_binaryexpression114, this.Value_ternaryexpression112, Simulator.register_euclid_factor.StoredValue.ToInt());
        this.Value.ValueCopy(this.Value_binaryexpression114);
        break;
      case 2:
        this.Value.ValueCopy(this.Constant_0);
        break;
      case 3:
        this.Value.ValueCopy(this.Constant_0);
        break;
      case 4:
        this.Value.ValueCopy(this.Constant_0);
        break;
      case 5:
        this.Value.ValueCopy(this.Constant_0);
        break;
      case 6:
        this.Value.ValueCopy(this.Constant_0);
        break;
      default:
        throw new ApplicationException("Internal Error - no definer for outport");
      }

        // Mark this entity as valid for this cycle 
        this.Cycle = Simulator.CurrentCycle;
    }
    
    public virtual void Initialize()
    {
        this.Value = new Integer(16, false);
        this.Constant_0 = new Integer(2, false);
        this.Value_binaryexpression109 = new Integer(1, false);
        this.Value_ternaryexpression112 = new Integer(16, false);
        this.Value_binaryexpression114 = new Integer(65552, false);
        this.Value = new Integer(16, false);
        this.Constant_0 = new Integer(2, false);
        this.Value_binaryexpression109 = new Integer(1, false);
        this.Value_ternaryexpression112 = new Integer(16, false);
        this.Value_binaryexpression114 = new Integer(65552, false);
        this.DependentOutports_ControlStep_0 = new IOutport[0];
        this.DependentOutports_ControlStep_1 = new IOutport[0];
        this.DependentOutports_ControlStep_2 = new IOutport[0];
        this.DependentOutports_ControlStep_3 = new IOutport[0];
        this.DependentOutports_ControlStep_4 = new IOutport[0];
        this.DependentOutports_ControlStep_5 = new IOutport[0];
        this.DependentOutports_ControlStep_6 = new IOutport[0];
    }
    
    public virtual IOutport[] GetDependentOutports()
    {
      switch(Simulator.controller_euclid_ctl.CurrentControlStep)
      {
      case 0:
        return this.DependentOutports_ControlStep_0;
      case 1:
        return this.DependentOutports_ControlStep_1;
      case 2:
        return this.DependentOutports_ControlStep_2;
      case 3:
        return this.DependentOutports_ControlStep_3;
      case 4:
        return this.DependentOutports_ControlStep_4;
      case 5:
        return this.DependentOutports_ControlStep_5;
      case 6:
        return this.DependentOutports_ControlStep_6;
      default:
        throw new ApplicationException("Internal Error");
      }
    }
}

public class OutPort_test_euclid_m : IOutport
{
    
    // Caches the outport value.
    internal Integer Value;
    
    internal String EntityName;
    
    /// The cycle for which the value field was last evaluated (debug purpose)
    internal Int32 Cycle;
    
    // The constant value 2322
    internal Integer Constant_2322;
    
    // Used for depth-first-search on outports
    internal Color color;
    
    internal IOutport[] DependentOutports_ControlStep_0;
    
    public virtual Color _Color
    {
        get
        {
            return this.color;
        }
        set
        {
            this.color = value;
        }
    }
    
    public virtual void Evaluate()
    {
      switch(Simulator.controller_h_test_euclid.CurrentControlStep)
      {
      case 0:
        this.Value.ValueCopy(this.Constant_2322);
        break;
      default:
        throw new ApplicationException("Internal Error - no definer for outport");
      }

        // Mark this entity as valid for this cycle 
        this.Cycle = Simulator.CurrentCycle;
    }
    
    public virtual void Initialize()
    {
        this.Value = new Integer(16, false);
        this.Constant_2322 = new Integer(12, "2322", false);
        this.Value = new Integer(16, false);
        this.Constant_2322 = new Integer(12, "2322", false);
        this.DependentOutports_ControlStep_0 = new IOutport[0];
    }
    
    public virtual IOutport[] GetDependentOutports()
    {
      switch(Simulator.controller_h_test_euclid.CurrentControlStep)
      {
      case 0:
        return this.DependentOutports_ControlStep_0;
      default:
        throw new ApplicationException("Internal Error");
      }
    }
}

public class OutPort_test_euclid_n : IOutport
{
    
    // Caches the outport value.
    internal Integer Value;
    
    internal String EntityName;
    
    /// The cycle for which the value field was last evaluated (debug purpose)
    internal Int32 Cycle;
    
    // The constant value 654
    internal Integer Constant_654;
    
    // Used for depth-first-search on outports
    internal Color color;
    
    internal IOutport[] DependentOutports_ControlStep_0;
    
    public virtual Color _Color
    {
        get
        {
            return this.color;
        }
        set
        {
            this.color = value;
        }
    }
    
    public virtual void Evaluate()
    {
      switch(Simulator.controller_h_test_euclid.CurrentControlStep)
      {
      case 0:
        this.Value.ValueCopy(this.Constant_654);
        break;
      default:
        throw new ApplicationException("Internal Error - no definer for outport");
      }

        // Mark this entity as valid for this cycle 
        this.Cycle = Simulator.CurrentCycle;
    }
    
    public virtual void Initialize()
    {
        this.Value = new Integer(16, false);
        this.Constant_654 = new Integer(10, "654", false);
        this.Value = new Integer(16, false);
        this.Constant_654 = new Integer(10, "654", false);
        this.DependentOutports_ControlStep_0 = new IOutport[0];
    }
    
    public virtual IOutport[] GetDependentOutports()
    {
      switch(Simulator.controller_h_test_euclid.CurrentControlStep)
      {
      case 0:
        return this.DependentOutports_ControlStep_0;
      default:
        throw new ApplicationException("Internal Error");
      }
    }
}

